package binarysearchTree;

import java.util.Arrays;
import java.util.Random;

public class Test {
    private static int[] randomArray(int num, int boundary) {
        int[] arr = new int[num];
        Random random = new Random();
        for (int i = 0; i < num; i++) {
            arr[i] = random.nextInt(boundary);
        }
        System.out.println(Arrays.toString(arr));
        return arr;
    }
    public static void main(String[] args) {
        BinarySearchTree binarySearchTree = new BinarySearchTree();
        int[] arr = {5,12,3,2,11,15,1,4,7,6,8,10,9};
//        int[] arr = randomArray(5,20);
        for (int i = 0; i < arr.length; i++) {
            binarySearchTree.insert(arr[i]);
        }
        int deleteTimes = 2;
        Random random = new Random();
        for (int i = 0; i < deleteTimes; i++) {
            int rad = random.nextInt(10);
            System.out.println("随机值是: "+rad);
            binarySearchTree.remove(rad);
        }
//        binarySearchTree.remove(5);

        System.out.println("========");
    }
}
